package com.android.kuai.zhuan.retrofit.api;

import com.android.kuai.zhuan.bean.AppListBean;
import com.android.kuai.zhuan.bean.UpgradeBean;
import com.android.kuai.zhuan.bean.UserIdBean;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

public interface ApiInterface {

    /**
     * 获取applist
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST("api/index/index")
    Observable<AppListBean> getAppList(@FieldMap Map<String, Object> map);

    @Streaming
    @GET
    Observable<ResponseBody> downloadFile(@Url String url);

    /**
     * 获取userId 、邀请码
     * @param map
     * @return
     */
    @POST("api/index/index")
    @FormUrlEncoded
    Observable<UserIdBean> getUserId(@FieldMap Map<String, Object> map);


    /**
     * 应用自升级
     * @param map
     * @return
     */
    @POST("api/index/index")
    @FormUrlEncoded
    Observable<UpgradeBean> getAppVersion(@FieldMap Map<String, Object> map);
}
